package cn.hg.jfsa.manage.controller.system;

import com.jfinal.kit.Kv;
import com.jfinal.kit.StrKit;

import cn.hg.base.jfinal.controller.BaseController;
import cn.hg.jfsa.web.theme.Theme;
import cn.hg.jfsa.web.theme.ThemeManager;

public class JfsaThemeOptionController extends BaseController {

	@Override
	public void index () {
		Theme theme = ThemeManager.me().getCurrentTheme();

		if (StrKit.notBlank(theme.getOptionsPage())) {
			this.set("themeOptionPage", theme.getWebAbsolutePath() + theme.getOptionsPage());
		} else {
			this.set("flashMsg", "当前主题没有配置参数设置页面！");
		}

	}

	@SuppressWarnings ("unchecked")
	public void save () {
		Kv kv = this.getKv();
		ThemeManager.me().setOptions(kv);
		this.set("flashMsg", "设置成功！");
		this.forwardAction("/manage/theme/option");
	}

}
